<?php

use yii\helpers\Url;

?>

<style>
    ul {
        padding: 0;
        margin: 0;
        list-style: none;
    }

    body {
        margin: 0;
    }

    .wrap {
        width: 300px;
        border: 1px solid #000;
        padding: 5px;
    }

    .txtList li {
        font: 18px/28px "微软雅黑";
        text-indent: 8px;
    }

    .navBtns {
        margin-top: 20px;
        padding-left: 20px;
        text-align: center;
    }

    .navBtns * {
        font: bold 18px/30px "微软雅黑";
        display: inline-block;
        background: #fff;
        width: 30px;
        margin: 0 5px;
        cursor: pointer;
        user-select: none;
        text-align: center;
        box-shadow: 0 0 5px #999;
        color: #4e4e4e;
    }

    .navBtns *:hover {
        background: #ccc;
        color: #4e4e4e;
    }

    .navBtns .active {
        color: red;
        border-color: red;
    }
</style>
<div class="navBtns">
    <?php if ($p > 1): ?>
       <?php if (isset($options)):?>
            <a href="<?= Url::to([$url, 'p' => $p - 1, 'options' => $options]) ?>" class="prev"><</a>
       <?php else:?>
            <a href="<?= Url::to([$url, 'p' => $p - 1, ]) ?>" class="prev"><</a>
       <?php endif;?>

    <?php endif; ?>

    <?php for ($_page = 1; $_page <= $total_page; $_page++): ?>
        <?php if ($_page == $p): ?>
            <a href="javascript::void(0)" class="active"><?= $_page ?></a>
        <?php else: ?>
            <?php if (isset($options)):?>
                <a href="<?= Url::to([$url, 'p' => $_page, 'options' => $options]) ?>"><?= $_page ?></a>
            <?php else:?>
                <a href="<?= Url::to([$url, 'p' => $_page]) ?>"><?= $_page ?></a>
            <?php endif;?>

        <?php endif; ?>
    <?php endfor; ?>
    <?php if ($p < $total_page): ?>
        <?php if (isset($options)):?>
            <a href="<?= Url::to([$url, 'p' => $p + 1, 'options' => $options]) ?>" class="next">></a>
        <?php else:?>
            <a href="<?= Url::to([$url, 'p' => $p + 1, ]) ?>" class="next">></a>
        <?php endif;?>
    <?php endif; ?>
</div>